LearningStoreItemIdentifier.GetKey Method

Retrieve the unique integer value assigned to the item.

Parent Type: LearningStoreItemIdentifier

Namespace: Microsoft.LearningComponents.Storage

Assembly: Microsoft.LearningComponents.Storage.dll

Syntax
C#

public long GetKey ()

Exceptions
Exception type Condition
System.InvalidOperationException

A unique integer value is not available.

Remarks

Note that this value only uniquely identifies an item within a particular item type. Two items with two different ItemTypeNames may return the same value from GetKey.

A unique integer value is not always available. In particular, a unique integer value is not available from LearningStoreItemIdentifiers returned from LearningStoreJob.AddItem. Identifiers returned from that method have not yet been added to the store, and therefore do not yet have a unique integer value.

Example

The following code creates a LearningStoreItemIdentifier and then retrieves the unique integer value:

C#
LearningStoreItemIdentifier id = new LearningStoreItemIdentifier("UserItem", 50);
long key = id.GetKey();
After the above code is executed, key contains 50.